#include "s_message_handle.h"



#include "icall_ble_api.h"

#include <icall_ble_api.h>

#include "s_ccs811.h"

#define S_MSG_HDL_MALLOC                                      ICall_malloc
#define S_MSG_HDL_FREE                                        ICall_free

#if !BLE_USE_PERIOD_NOTIFY
static S_Message_Handle_SingleNotify_t *s_msg_handle_singlenotify_app = NULL;
#endif

signed char S_MESSAGE_HANDLE_GetRspFromBLE(unsigned char *data, unsigned short *len)
{
    signed char rslt = 0;

//    unsigned char adata[] = "ABCDEFG";
//    memcpy(data, adata, 7);
//    *len = 7;
    memcpy(data, s_ccs811_out_data, s_ccs811_out_data_len);
    *len = s_ccs811_out_data_len;

    return rslt;
}

#if !BLE_USE_PERIOD_NOTIFY
signed char S_MESSAGE_HANDLE_SingleNotify_FunRegist(S_Message_Handle_SingleNotify_t *app)
{
    if(app)
    {
        s_msg_handle_singlenotify_app = app;
        return 0;
    }
    return (-1);
}

void S_MESSAGE_HANDLE_SingleNotify_RspFromBLE(void)
{
    s_msg_handle_singlenotify_app->singlenotify_fun();
}
#endif

